﻿
<div class="us_login_pop Clearfix">
    <table class="log_pop">
        <tr>
            <th>User name :</th>
            <td>
                <input type="text" id="username" />
            </td>
        </tr>
        <tr>
            <th>Password:</th>
            <td>
                <input type="password" id="pass" />
            </td>
        </tr>       
    </table>
    <div>
    <a onclick="onlogin()" class="btn_login">Login</a>
    <a onclick="_closePopup()" class="btn_cancel">Cancel</a>
    </div>
</div>

<script type="text/javascript">


    function onlogin() {
        showLoading();   
        var itemObj = getInfoLogOn();
        if (itemObj == null) {
            hideLoading();
            return;
        }
        $.post("/user/LoginAction", itemObj, function (data) {
            var msg = data.Msg;
            if (msg == "") {
                //$("#nameUser").load();
                location.reload();
                closePopup();
            }
            else {
                hideLoading();
                cusAlert(msg);
            }
        });
    }
    function getInfoLogOn() {
        var uid = $("#username").val();
        var pwd = $("#pass").val();
        return { UserName: uid, Password: pwd };
    }

    $(document).ready(function () {
        _openPopup("Đăng nhập"); 
    });
    

</script>